package com.ruoyi.service.impl;

import com.ruoyi.domain.Course;
import com.ruoyi.domain.CourseVideo;
import com.ruoyi.domain.DTO.CourseDetailDTO;
import com.ruoyi.mapper.CourseMapper;
import com.ruoyi.mapper.CourseVideoMapper;
import com.ruoyi.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Autowired
    private CourseVideoMapper courseVideoMapper;

    @Override
    public int insertCourse(Course course) {
        return courseMapper.insertCourse(course);
    }

//    @Override
//    public CourseDetailDTO getCourseWithVideos(Integer courseId) {
//        Course course = courseMapper.selectCourseById(courseId);
//        if (course == null) {
//            throw new RuntimeException("课程不存在");
//        }
//
//        List<CourseVideo> videos = courseVideoMapper.selectVideosByCourseId(courseId);
//
//        CourseDetailDTO dto = new CourseDetailDTO();
//        dto.setCourse(course);
//        dto.setVideos(videos);
//        return dto;
//    }
}
